$(function(){
	$("#addQuestion1").click(addQuestion);
});

//输入问题的js
function addQuestion() {
	$.post('../questions/addQuestion',{"content":$("#content").val(),"CompanyUserId":GetQueryString("companyUserId"),"activityId":GetQueryString("activityId")},function(data){
		if(data.result) {
			/* $.messager.show({
                title:'消息',
                msg:'保存成功',
                timeout:1500,
                showType:'slide'
            }); */
            alert("已经成功提问");
			//跳到新页面
			window.location.href="../view/sign";
		}else {
			alert("对不起，提问失败");
			//alert(data.info);
		}
	},'json');
}
//接受参数
function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}

function questionList(){
	$.post('../../questions/listQuestions',{"activityId":GetQueryString("activityId")},function(data) {
		var str = "";
		var str2= "";
		$(data.listQuestions).each(function() {
			str += this.content;
			str2+= this.ctime;
		});
		$("#test").html(str);
		$("str2").html(str2);
	},'json');
}

//回车事件
document.onkeydown = function(e){ 
    var ev = document.all ? window.event : e;
    if(ev.keyCode==13) {
    	doSearch();	  
    }
};

function ResetText(){
    document.getElementById('content').value = ""; 
    }

function toggleAnswer(id){
//	var a =i;
//	 $(".answer_div_"+id).toggle();
	 $("#"+id).toggle();
//     alert("参数");
    }

function exit(){
	$.post('../manager/logout',function(data) {
		window.location.href="../manager/loginin";
		window.location.href="../jsp/login.jsp";
	});
}